<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>订单列表</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="/${BasePath}/static/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="/${BasePath}/static/css/public.css" media="all" type="text/css">
</head>
<body class="childrenBody">
<form class="layui-form" lay-filter="example">
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
	  <legend>订单列表</legend>
	</fieldset>
	<table id="ordersList" lay-filter="ordersList"></table>
</form>
	<!--审核状态-->
	<script type="text/html" id="orderStatus">
		{{#  if(d.orderStatus == "2"){ }}
		<span class="layui-red">待发货</span>
		{{#  } else if(d.orderStatus == "3"){ }}
		<span class="layui-blue">待收货</span>
        {{#  } else if(d.orderStatus == "1"){ }}
		<span class="layui-yellow">未付款</span>
		{{#  } else { }}
			已完成
		{{#  }}}
	</script>

	<!--操作-->
	<script type="text/html" id="roleListBar">
        {{#  if(d.orderStatus == "2"){ }}
		<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="send">发货</a>
        {{#  }}}
        {{#  if(d.orderStatus != "2"&&d.orderStatus != "4"){ }}
		<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="send">修改物流</a>
        {{#  }}}
		<a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="look">查看</a>
	</script>
<script src="/${BasePath}/static/layui/layui.js" charset="utf-8" type="text/javascript"></script>
<script type="text/javascript" src="/${BasePath}/static/js/common/jquery-2.1.0.min.js"></script>
<script type="text/javascript">
layui.use(['form','layer','laydate','table','laytpl'],function(){
    var form = layui.form,
        layer = parent.layer === undefined ? layui.layer : top.layer,
        $ = layui.jquery,
        laydate = layui.laydate,
        laytpl = layui.laytpl,
        table = layui.table;

    //列表
    var tableIns = table.render({
        elem: '#ordersList',
        url : '/${BasePath}/order/queryorderPage',
        cellMinWidth : 95,
        page : true,
        height : "full-125",
        limit : 20,
        limits : [1,10,15,20,25],
        id : "ordersListTable",
        cols : [[
            {field: 'orderNum', title: '订单号'},
            {field: 'productName', title: '购买的商品'},
            {field: 'orderAmount', title: '订单金额'},
            {field: 'orderStatus', title: '状态', align:'center',templet:"#orderStatus"},
            {title: '操作', width:170, templet:'#roleListBar',fixed:"right"}
        ]]
    ,skin: 'line'											
    });
    //列表操作
    table.on('tool(ordersList)', function(obj){
        var layEvent = obj.event,
            data = obj.data;

        if(layEvent === 'look'){ //查看
        	layer.open({
      		  type: 2,
      		  title: '订单信息',
      		  skin: 'layui-layer-rim', //加上边框
      		  shadeClose: true,
      		  shade: 0.8,
      		  area: ['90%', '80%'],
      		  content: "/${BasePath}/order/orderDetail?id="+data.id
      		});  
        } else if(layEvent === 'send'){ //发货
        	layer.open({
        		  type: 2,
        		  title: '物流信息填写',
        		  skin: 'layui-layer-rim', //加上边框
        		  shadeClose: true,
        		  shade: 0.8,
        		  area: ['550px', '80%'],
        		  content: '/${BasePath}/order/addLogistics?id='+data.id
        		});         	
        } 
    });

})
</script>
</body>
</html>